home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10046 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: mcrware.microware.com!jejones
  2. From: jejones@microware.com (James Jones)
  3. Newsgroups: comp.lang.c++
  4. Subject: well-chosen overloading (was Re: Will Java kill C++?)
  5. Date: 5 Mar 1996 21:33:29 GMT
  6. Organization: Microware Systems Corp., Des Moines, Iowa
  7. Message-ID: <4hibv9$8bu@mcrware.microware.com>
  8. References: <313613B2.136E@ksopk.sprint.com> <4h554t$9jk@netline-fddi.jpl.nasa.gov> <4h8ka3$4o8@atlas.tus.ssi1.com>
  9. NNTP-Posting-Host: mork.microware.com
  10.  
  11. In article <4h8ka3$4o8@atlas.tus.ssi1.com> Mike Palmer <Mike.Palmer@tus.ssi1.com> writes:
  12. >Although I could use overloaded operators to create a language that 
  13. >only I understand, if they are used in an intelligent and judicious
  14. >manner, they can enhance the readability of code significantly, even 
  15. >for someone who doesn't know beans about your classes.
  16.  
  17. What would be good rules for intelligent and judicious use?  It's not a 
  18. rhetorical question; I really would like to know.  For example, I've always
  19. wondered why the stream output operator isn't += (-= for input); also, the
  20. existing operators, which are all that one can use as operators in C++,
  21. carry connotations with them that may be misleading.
  22.  
  23. (Come to think of it, while I'm asking about streams, it's obviously a
  24. a good idea to write
  25.  
  26.     cout << (i << j);
  27.  
  28. to output the result of shifting i left j bits, but is it necessary?)
  29.  
  30.     James Jones
  31.  
  32. Opinions herein are those of the author, and not necessarily those of any
  33. organization.
  34.